﻿<?php
include("../nav_data.php");
include("../lib/template.inc");
function render($pagename,$nav_title,$nav_link,$doc)
{
	$tmpro=new template();
	$tmpro->set_file("main_frame","main_frame.html");
	$tmpro->set_var("current_pagename",$pagename);
	$tmpro->set_block("main_frame","nav","nevagator");
	$tmpro->set_block("main_frame","guide","left");
	$tmpro->set_block("main_frame","subframe","right");
	
		foreach($nav_title as $nav_count=>$nav_title)
		{
			$tmpro->set_var("pagename",$nav_title);
			$tmpro->set_var("link",$nav_link[$nav_count]);
			$tmpro->parse("nevagator","nav",true);
		}
		
		foreach($doc as $framecount=>$unit)
		{
			$tmpro->set_var("framecount",$framecount);
			if(isset($unit["processor"]))
			{
				$tmpro->set_var("processor",$unit["processor"]);
				if(isset($unit["submit_name"]))
					$tmpro->set_var("submit",'<input type="submit" height="15" name="submit" value="'.$unit["submit_name"].'" />');
				else
					$tmpro->set_var("submit",'<input type="submit" height="15" name="submit" value="提交" />');
			}
			else
			{
				$tmpro->set_var("processor",'');
				$tmpro->set_var("submit",'');
			}
			$tmpro->set_var("guide_content",$unit["title"]);
			$tmpro->set_var("subframe_title",$unit["title"]);
			$tmpro->set_var("subframe_content",$unit["content"]);
			$tmpro->set_var("widper",$unit["wid"]);
			$tmpro->parse("left","guide",true);
			$tmpro->parse("right","subframe",true);
		}
	$tmpro->parse("out","main_frame");
	$tmpro->p("out");
}
?>
